import { IPSDEUILogic } from './ipsdeuilogic';
import { IPSDEUILogicParam } from './ipsdeuilogic-param';
import { IPSDEUIThrowExceptionLogic } from './ipsdeuithrow-exception-logic';
import { PSDEUILogicNodeImpl } from './psdeuilogic-node-impl';

export class PSDEUIThrowExceptionLogicImpl extends PSDEUILogicNodeImpl implements IPSDEUIThrowExceptionLogic {
  get errorCode(): number {
    return this.M.errorCode;
  }

  get errorInfo(): string {
    return this.M.errorInfo;
  }

  get exceptionObj(): string {
    return this.M.exceptionObj;
  }

  protected exceptionparam: IPSDEUILogicParam | null = null;

  getExceptionParam(): IPSDEUILogicParam | null {
    if (this.exceptionparam != null) return this.exceptionparam;
    const value = this.M.getExceptionParam;
    if (value == null) {
      return null;
    }
    const ipsdeuilogic = this.getParentPSModelObject('dataentity.logic.IPSDEUILogic') as IPSDEUILogic;
    if (ipsdeuilogic != null) {
      this.exceptionparam = ipsdeuilogic.findPSDEUILogicParam(value);
    }
    return this.exceptionparam;
  }

  get exceptionParam(): IPSDEUILogicParam | null {
    return this.getExceptionParam();
  }

  getExceptionParamMust(): IPSDEUILogicParam {
    const value = this.getExceptionParam();
    if (value == null) {
      throw new Error('未指定异常参数对象');
    }
    return value;
  }

  get cls(): string {
    return 'PSDEUIThrowExceptionLogicImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.logic.IPSDEUIThrowExceptionLogic') return true;
    return super.instanceof(cls);
  }
}
